/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * DrawPanel.java
 *
 * Created on Oct 10, 2009, 3:03:52 PM
 */

package gui;
import Controller.UseCaseController;
import Controller.DiagramController;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;
import java.io.*;
import javax.imageio.*;
import java.awt.Image;
import java.net.URL;
import Data.Diagram.*;
import Data.DiagramFactory.*;

/**
 *
 * @author Sean
 */
public class DrawPanel extends javax.swing.JPanel{
    private JTabbedPane tab;
    private UseCaseController dPanelEvnt = new UseCaseController();
    private DiagramController dEvntController = new DiagramController();
    /** Creates new form DrawPanel */
    public DrawPanel(JTabbedPane jTabbedPane1) {
        tab = jTabbedPane1;
        initComponents();
    }

    public void paintComponent(Graphics g) {
        //Graphics2D g2 = (Graphics2D) g;
        //g2.drawImage(actorImg, 100, 100, this);
        super.paintComponent(g);
        DiagramInterface currDiagram = new Diagram();
        DiagramFactoryImpl factTest = new DiagramFactoryImpl();
        //currDiagram.add(new Actor("Ryan", 20, 20));
        //currDiagram.add(new Connector(20, 20, 40, 40));
        //currDiagram.add(new Data.Diagram.System("waynes world", 40, 50, 180, 100));
        //currDiagram.add(new UseCase("get phat", 68, 46, 56, 40));
        //currDiagram.draw(g);
        currDiagram = factTest.GenerateDiagram(null);
        currDiagram.draw(g);
        return;
    }



    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    //@SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();
        jMenuBar2 = new javax.swing.JMenuBar();
        jMenu3 = new javax.swing.JMenu();
        jMenu4 = new javax.swing.JMenu();
        jMenuBar3 = new javax.swing.JMenuBar();
        jMenu5 = new javax.swing.JMenu();
        jMenu6 = new javax.swing.JMenu();
        jPopupMenu1 = new javax.swing.JPopupMenu();
        jButton4 = new javax.swing.JButton();

        jMenu1.setText("File");
        jMenuBar1.add(jMenu1);

        jMenu2.setText("Edit");
        jMenuBar1.add(jMenu2);

        jMenu3.setText("File");
        jMenuBar2.add(jMenu3);

        jMenu4.setText("Edit");
        jMenuBar2.add(jMenu4);

        jMenu5.setText("File");
        jMenuBar3.add(jMenu5);

        jMenu6.setText("Edit");
        jMenuBar3.add(jMenu6);

        setAutoscrolls(true);
        setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);

        jButton4.setText("Close");
        jButton4.setFocusable(false);
        jButton4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(685, Short.MAX_VALUE)
                .addComponent(jButton4)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jButton4)
                .addContainerGap(397, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        dEvntController.closePressed(tab);// TODO add your handling code here:
    }//GEN-LAST:event_jButton4ActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton4;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenu jMenu6;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuBar jMenuBar2;
    private javax.swing.JMenuBar jMenuBar3;
    private javax.swing.JPopupMenu jPopupMenu1;
    // End of variables declaration//GEN-END:variables



}
